package com.shanghaionstar.notifysetting;

import android.content.Context;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

import com.shanghaionstar.R;

/**
 * Created by Rengui Lu on 2017/4/24.
 */

public class NotifyClickSpan extends ClickableSpan {
    private final View.OnClickListener mListener;
    private Context context;

    public NotifyClickSpan(View.OnClickListener l, Context context) {
        mListener = l;
        this.context = context;
    }

    /**
     * 重写父类点击事件
     */
    @Override
    public void onClick(View v) {
        mListener.onClick(v);
    }

    /**
     * 重写父类updateDrawState方法  我们可以给TextView设置字体颜色,背景颜色等等...
     */
    @Override
    public void updateDrawState(TextPaint ds) {
        ds.setColor(context.getResources().getColor(R.color.color_1870c3));
    }
}
